package org.munoz.client;

import org.munoz.shared.LoginInfo;
import org.munoz.shared.Rank;

import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
import com.google.gwt.user.client.rpc.XsrfProtectedService;

@RemoteServiceRelativePath("intro")
public interface GoFishService extends RemoteService { 
	
	/**
	 * Requests login by the user. 
	 * @param requestUri
	 * @return login information
	 */
	public LoginInfo login(String requestUri, LoginInfo loginInfo);

	/**
	 * Passes the information of the user to the server to match it against other players
	 * @param playerId
	 * @param state
	 * @return the order of the player turns in the game. 
	 */
	public String matchPlayer(String playerId, String state);

	/**
	 * Makes a move at the server and passes the new state to the players
	 * @param playerId
	 * @param state
	 * @return the opponents name
	 */
	public String makeMoveAtServer(String playerId, String state);

	/**
	 * @return a list of the matches for the current user. 
	 */
	public String [] loadMatches(LoginInfo loginI);
	
	/**
	 * Randomly matches two players
	 */
	public void automatch(LoginInfo loginI);
	
	/**
	 * Connect player to Channel
	 */
	public String connectPlayer();
	
	/**
	 * @param fbId
	 * @param loginI
	 * @return true if fbFriend exists
	 */
	public Boolean newGameFromFBId(String fbId, LoginInfo loginI);
	
	
	/**
	 * @param email
	 * @return true if email belongs to user that exists. 
	 */
	public Boolean newGameFromEmail(String email, LoginInfo loginI);
	
	/**
	 * Deletes a match for the database
	 * @param matchId
	 */
	public void deleteMatch(Long matchId, LoginInfo loginI);
	
	
	/**
	 * Changes the match that is being played
	 * @param matchId
	 * @return
	 */
	public String changeMatch(Long matchId, LoginInfo loginI);
	
	
	
	/**
	 * Makes a move in the server. 
	 * @param matchId
	 * @param move
	 * @param state
	 */
	public void makeMove(Long matchId, String move, String state, LoginInfo l);
	
	/**
	 * Tests RPC communication with server
	 * @param state
	 * @param id
	 * @return message from server
	 * @throws IllegalArgumentException
	 */
	public String sayHi(String state, String id) throws IllegalArgumentException;

}
